﻿@{
    ViewData["Title"] = "首页";
}
@if (Context.Request.Host.Value.Equals("www.oauthapp.com"))
{
<main>
    <div class="container">
        <div class="row">
            <div class="col-md-6 offset-md-3 col-12">
                <div class="mt-5 card">
                    <div class="card-body">
                        <div class="card-title">站点</div>
                        <hr />

                        <div class="mb-3">
                            <label class="form-label">域名（6-12位小写字母）</label>
                            <div class="input-group">
                                <input type="text" id="domain" class="form-control">
                                <span class="input-group-text bg-white border-0">.oauthapp.com</span>
                            </div>
                        </div>

                        <div class="mb-3">
                            <button type="button" class="btn btn-success" onclick="GoRegister()">创建</button>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</main>

<script type="text/javascript">
    function GoRegister() {
        var domain = document.getElementById('domain').value;
        if (!domain || domain.length < 6 || domain.length > 12) {
            alert('长度在6-12位')
            return;
        }
        location.href = `https://${domain}.oauthapp.com/tenant/auth/signup`;
    }
</script>
}